<?php 
	namespace Admin\Model;
	use Think\Model;
/**
 * 后台用户模型
 */
	class UserModel extends Model {		
		public function checkEmail($email)
		{		
			// var_dump($email);
			//邮箱正则
			$preg="/^[\w][\w]{2,18}@+[\w]{2,8}.+[com|cn]$/";
			$data=preg_match($preg, $email);
			if ($data) {
				$res=M('user')->where("email='$email'")->find();
					if ($res) {
							Reajax(1,"邮箱已注册");
						}
			}else{
				Reajax(1,"邮箱不合格式");
			}
		}
		public function checkNickname($username)
		{		


			if (mb_strlen($username)>6 && mb_strlen($username)<18) {
					// var_dump($username);
					$res=M('user')->where("nickname='$username'")->find();
					// var_dump(strlen($username));exit;
					if ($res) {
						Reajax(1,"昵称已注册");
					}

			}else{
				Reajax(1,"昵称字数在6——18之间");
			}
				
			
			
			

			
		}
	

	};




 ?>